package day021.homework.p10;

import java.util.ArrayList;
import java.util.Random;

public class Car {
    private static final int count = 3;
    private static ArrayList<Car> carList = new ArrayList<>();

    private Car() {
    }

    static {
        for (int i = 0; i < count; i++) {
            carList.add(new Car());
        }
    }

    public static Car getInstance() {
        int index = new Random().nextInt(count);
        return carList.get(index);
    }
}
